package everyday;

import org.junit.jupiter.api.Test;

import java.util.Arrays;

public class T1615 {
    public int maximalNetworkRank(int n, int[][] roads) {
        int max = 0;
        int[] ints = new int[n];
        boolean[][] b = new boolean[n][n];
        for (int[] road : roads) {
            ints[road[0]]++;
            ints[road[1]]++;
            b[road[0]][road[1]] = true;
            b[road[1]][road[0]] = true;
        }
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                max=Math.max(max,ints[i]+ints[j]-(b[i][j]?1:0));
            }
        }
        return max;
    }

    @Test
    public void test() {

    }
}
